<template>
<div class="app">
    <h2>App:{{ message }}</h2>
    <Home></Home>
</div>
</template>
<script>
// 使用事件总线通信 的组件要导入库 app与homenav通信
import eventBus from './utils/event-bus'
import Home from './Home.vue'
export default {
    components: {
        Home
    },
    data() {
        return {
            message:"hello"
        }
    },
    created() {
        // 事件监听 通过监听homenav的点击事件改变了message的值
        eventBus.on("Eventemit", (name,age) => {
            console.log("Eventemit", name, age)
            this.message=`${name},age:${age}`

        })
        
    }
}
</script>
<style scoped lang="less">

</style>